package com.jwb.pub.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONObject;
import com.jwb.pub.service.AsyncService;

@Controller
@RequestMapping(value = "/pub/test")
public class TestController {
	
	@Autowired
	private AsyncService asyncService;
	
	@RequestMapping("/async")
	@ResponseBody
	public String asyncTest(){
		JSONObject jso = new JSONObject();
		for(int i=0;i<10;i++){
			asyncService.asyncSleep(i, 5000);
		}
		jso.put("code", "0");
		jso.put("msg", "OK");
		return jso.toString();		
	}
	
	
}
